package com.starbaba.system.index;

import java.util.HashMap;

import org.apache.commons.lang.StringUtils;

import com.opensymphony.xwork2.Action;
import com.starbaba.core.utils.Struts2Utils;
import com.starbaba.core.web.constant.WebConstants;
import com.starbaba.core.web.struts2.BaseAction;
import com.starbaba.system.user.model.UserVO;
import com.tuanzi.server.loan_base.util.DateUtils;

/**
 * Desktop Action
 * 
 * @anthor hyb
 * @since 2012-09-12
 * 
 */
@SuppressWarnings("serial")
public class DesktopAction extends BaseAction {
	
	
	@Override
	public String execute() {
		UserVO userVO = (UserVO) Struts2Utils.getSessionAttribute(WebConstants.SESSION_ATTRIBUTE_USER);
		if (null == userVO) {
			this.addErrorMessage("请登录系统");
			return Action.ERROR;
		}
		initData();
		return Action.SUCCESS;
	}

	/**
	 * 首页数据统计
	 *
	 */
	public void initData() {
		String selectTime = Struts2Utils.getRequest()
				.getParameter("selectTime");
		if (StringUtils.isBlank(selectTime)) {
			selectTime = DateUtils.getCurrentDate();
		}
		if (paramsMap == null)
			paramsMap = new HashMap<String, Object>();

		paramsMap.put("selectTime", selectTime);


	}
}
